home *** CD-ROM | disk | FTP | other *** search
/ Concrete Construction Image Library / Concrete Construction Image Library - Volume 1.iso / mac / ftiens4.js < prev    next >
Text File  |  2002-07-18  |  20KB  |  765 lines

  1. //**************************************************************** 
  2. // Keep this copyright notice: 
  3. // This copy of the script is the property of the owner of the 
  4. // particular web site you were visiting.
  5. // Do not download the script's files from there.
  6. // For a free download and full instructions go to: 
  7. // http://www.treeview.net
  8. //**************************************************************** 
  9.  
  10. // Log of changes: 
  11. //
  12. //       18 Jul 02 - Changes in pre-load images function
  13. //
  14. //       13 Jun 02 - Add ICONPATH var to allow for gif subdir
  15. //       
  16. //       20 Apr 02 - Improve support for frame-less layout
  17. //
  18. //       07 Apr 02 - Minor changes to support server-side dynamic feeding
  19. //                   (Online Bookmarks Manager demo)
  20. //
  21. //       10 Aug 01 - Support for Netscape 6
  22. //
  23. //       17 Feb 98 - Fix initialization flashing problem with Netscape
  24. //       
  25. //       27 Jan 98 - Root folder starts open; support for USETEXTLINKS; 
  26. //                   make the ftien4 a js file 
  27.  
  28.  
  29. // Definition of class Folder 
  30. // ***************************************************************** 
  31.  
  32. function Folder(folderDescription, hreference) //constructor 
  33.   //constant data 
  34.   this.desc = folderDescription 
  35.   this.hreference = hreference 
  36.   this.id = -1   
  37.   this.navObj = 0  
  38.   this.iconImg = 0  
  39.   this.nodeImg = 0  
  40.   this.isLastNode = 0 
  41.   this.isLastOpenedFolder = false
  42.  
  43.   //dynamic data 
  44.   this.isOpen = true 
  45.   this.iconSrc = ICONPATH + "ftv2folderopen.gif"   
  46.   this.iconSrcClosed = ICONPATH + "ftv2folderclosed.gif"   
  47.   this.children = new Array 
  48.   this.nChildren = 0 
  49.  
  50.   //methods 
  51.   this.initialize = initializeFolder 
  52.   this.setState = setStateFolder 
  53.   this.addChild = addChild 
  54.   this.createIndex = createEntryIndex 
  55.   this.escondeBlock = escondeBlock
  56.   this.esconde = escondeFolder 
  57.   this.mostra = mostra 
  58.   this.renderOb = drawFolder 
  59.   this.totalHeight = totalHeight 
  60.   this.subEntries = folderSubEntries 
  61.   this.outputLink = outputFolderLink 
  62.   this.blockStart = blockStart
  63.   this.blockEnd = blockEnd
  64.  
  65. function initializeFolder(level, lastNode, leftSide) 
  66.   var j=0 
  67.   var i=0 
  68.   var numberOfFolders 
  69.   var numberOfDocs 
  70.   var nc 
  71.   var nodeIconName = ""
  72.       
  73.   nc = this.nChildren 
  74.    
  75.   this.createIndex() 
  76.  
  77.   var auxEv = "" 
  78.  
  79.   if (browserVersion > 0) 
  80.     auxEv = "<a href='javascript:clickOnNode("+this.id+")'>" 
  81.   else 
  82.     auxEv = "<a>" 
  83.  
  84.   if (level>0) 
  85.     if (lastNode) //the last child in the children array 
  86.     { 
  87.       nodeIconName = ICONPATH + "ftv2mlastnode.gif"
  88.       if (this.nChildren == 0)
  89.          nodeIconName = ICONPATH + "ftv2lastnode.gif"
  90.       this.renderOb(leftSide + "<td valign=top>" + auxEv + "<img name='nodeIcon" + this.id + "' id='nodeIcon" + this.id + "' src='" + nodeIconName + "' width=16 height=22 border=0></a></td>") 
  91.       leftSide = leftSide + "<td valign=top><img src='" + ICONPATH + "ftv2blank.gif' width=16 height=22></td>"  
  92.       this.isLastNode = 1 
  93.     } 
  94.     else 
  95.     { 
  96.       nodeIconName = ICONPATH + "ftv2mnode.gif"
  97.       if (this.nChildren == 0)
  98.         nodeIconName = ICONPATH + "ftv2node.gif"
  99.       this.renderOb(leftSide + "<td valign=top background=" + ICONPATH + "ftv2vertline.gif>" + auxEv + "<img name='nodeIcon" + this.id + "' id='nodeIcon" + this.id + "' src='" + nodeIconName + "' width=16 height=22 border=0></a></td>") 
  100.       leftSide = leftSide + "<td valign=top background=" + ICONPATH + "ftv2vertline.gif><img src='" + ICONPATH + "ftv2vertline.gif' width=16 height=22></td>" 
  101.       this.isLastNode = 0 
  102.     } 
  103.   else 
  104.     this.renderOb("") 
  105.    
  106.   if (nc > 0) 
  107.   { 
  108.     level = level + 1 
  109.     for (i=0 ; i < this.nChildren; i++)  
  110.     { 
  111.       if (i == this.nChildren-1) 
  112.         this.children[i].initialize(level, 1, leftSide) 
  113.       else 
  114.         this.children[i].initialize(level, 0, leftSide) 
  115.       } 
  116.   } 
  117.  
  118. function drawFolder(leftSide) 
  119.   var idParam = "id='folder" + this.id + "'"
  120.  
  121.   if (browserVersion == 2) { 
  122.     if (!doc.yPos) 
  123.       doc.yPos=20 
  124.   } 
  125.  
  126.   this.blockStart("folder")
  127.  
  128.   doc.write("<tr>") 
  129.   doc.write(leftSide) 
  130.   doc.write ("<td valign=top>")
  131.   if (USEICONS)
  132.   {
  133.     this.outputLink() 
  134.     doc.write("<img id='folderIcon" + this.id + "' name='folderIcon" + this.id + "' src='" + this.iconSrc+"' border=0></a>") 
  135.   }
  136.   else
  137.   {
  138.       doc.write("<img src=" + ICONPATH + "ftv2blank.gif height=2 width=2>")
  139.   }
  140.   if (WRAPTEXT)
  141.     doc.write("</td><td valign=middle width=100%>") 
  142.   else
  143.     doc.write("</td><td valign=middle nowrap width=100%>") 
  144.   if (USETEXTLINKS) 
  145.   { 
  146.     this.outputLink() 
  147.     doc.write(this.desc + "</a>") 
  148.   } 
  149.   else 
  150.     doc.write(this.desc) 
  151.   doc.write("</td>")  
  152.  
  153.   this.blockEnd()
  154.  
  155.   if (browserVersion == 1) { 
  156.     this.navObj = doc.all["folder"+this.id] 
  157.     if (USEICONS)
  158.       this.iconImg = doc.all["folderIcon"+this.id] 
  159.     this.nodeImg = doc.all["nodeIcon"+this.id] 
  160.   } else if (browserVersion == 2) { 
  161.     this.navObj = doc.layers["folder"+this.id] 
  162.     if (USEICONS)
  163.       this.iconImg = this.navObj.document.images["folderIcon"+this.id] 
  164.     this.nodeImg = this.navObj.document.images["nodeIcon"+this.id] 
  165.     doc.yPos=doc.yPos+this.navObj.clip.height 
  166.   } else if (browserVersion == 3) { 
  167.     this.navObj = doc.getElementById("folder"+this.id)
  168.     if (USEICONS)
  169.       this.iconImg = doc.getElementById("folderIcon"+this.id) 
  170.     this.nodeImg = doc.getElementById("nodeIcon"+this.id)
  171.   } 
  172.  
  173. function setStateFolder(isOpen) 
  174.   var subEntries 
  175.   var totalHeight 
  176.   var fIt = 0 
  177.   var i=0 
  178.   var currentOpen
  179.  
  180.   if (isOpen == this.isOpen) 
  181.     return 
  182.  
  183.   if (browserVersion == 2)  
  184.   { 
  185.     totalHeight = 0 
  186.     for (i=0; i < this.nChildren; i++) 
  187.       totalHeight = totalHeight + this.children[i].navObj.clip.height 
  188.       subEntries = this.subEntries() 
  189.     if (this.isOpen) 
  190.       totalHeight = 0 - totalHeight 
  191.     for (fIt = this.id + subEntries + 1; fIt < nEntries; fIt++) 
  192.       indexOfEntries[fIt].navObj.moveBy(0, totalHeight) 
  193.   }  
  194.   this.isOpen = isOpen;
  195.  
  196.   if (this.id!=0 && PERSERVESTATE && !this.isOpen) //closing
  197.   {
  198.     currentOpen = GetCookie("clickedFolder")
  199.     if (currentOpen != null)
  200.     {
  201.         currentOpen = currentOpen.replace(this.id+"-", "")
  202.         SetCookie("clickedFolder", currentOpen)
  203.     }
  204.   }
  205.     
  206.   if (!this.isOpen && this.isLastOpenedfolder)
  207.   {
  208.         lastOpenedFolder = -1;
  209.         this.isLastOpenedfolder = false;
  210.   }
  211.   propagateChangesInState(this) 
  212.  
  213. function propagateChangesInState(folder) 
  214. {   
  215.   var i=0 
  216.  
  217.   //Support for empty folder (still usefull because of their link)
  218.   if (folder.isOpen) 
  219.   { 
  220.     if (folder.nodeImg && folder.nChildren > 0) 
  221.       if (folder.isLastNode) 
  222.         folder.nodeImg.src = ICONPATH + "ftv2mlastnode.gif" 
  223.       else 
  224.         folder.nodeImg.src = ICONPATH + "ftv2mnode.gif" 
  225.     if (USEICONS)
  226.       folder.iconImg.src = folder.iconSrc
  227.     for (i=0; i<folder.nChildren; i++) 
  228.       folder.children[i].mostra() 
  229.   } 
  230.   else 
  231.   { 
  232.     if (folder.nodeImg && folder.nChildren > 0) 
  233.       if (folder.isLastNode) 
  234.         folder.nodeImg.src = ICONPATH + "ftv2plastnode.gif" 
  235.       else 
  236.         folder.nodeImg.src = ICONPATH + "ftv2pnode.gif" 
  237.     if (USEICONS)
  238.       folder.iconImg.src = folder.iconSrcClosed
  239.     for (i=0; i<folder.nChildren; i++) 
  240.       folder.children[i].esconde() 
  241.   }  
  242.  
  243. function escondeFolder() 
  244.   this.escondeBlock()
  245.    
  246.   this.setState(0) 
  247.  
  248. function outputFolderLink() 
  249.   if (this.hreference) 
  250.   { 
  251.     if (USEFRAMES)
  252.       doc.write("<a href='" + this.hreference + "' TARGET=\"basefrm\" ") 
  253.     else
  254.       doc.write("<a href='" + this.hreference + "' TARGET=_top ") 
  255.  
  256.     if (browserVersion > 0 && USEFRAMES) 
  257.       doc.write("onClick='javascript:clickOnFolder("+this.id+")'") 
  258.  
  259.     doc.write(">") 
  260.   } 
  261.   else 
  262.     doc.write("<a>") 
  263.  
  264. function addChild(childNode) 
  265.   this.children[this.nChildren] = childNode 
  266.   this.nChildren++ 
  267.   return childNode 
  268.  
  269. function folderSubEntries() 
  270.   var i = 0 
  271.   var se = this.nChildren 
  272.  
  273.   for (i=0; i < this.nChildren; i++){ 
  274.     if (this.children[i].children) //is a folder 
  275.       se = se + this.children[i].subEntries() 
  276.   } 
  277.  
  278.   return se 
  279.  
  280.  
  281. // Definition of class Item (a document or link inside a Folder) 
  282. // ************************************************************* 
  283.  
  284. function Item(itemDescription, itemLink) // Constructor 
  285.   // constant data 
  286.   this.desc = itemDescription 
  287.   this.link = itemLink 
  288.   this.id = -1 //initialized in initalize() 
  289.   this.navObj = 0 //initialized in render() 
  290.   this.iconImg = 0 //initialized in render() 
  291.   this.iconSrc = ICONPATH + "ftv2doc.gif" 
  292.  
  293.   // methods 
  294.   this.initialize = initializeItem 
  295.   this.createIndex = createEntryIndex 
  296.   this.esconde = escondeBlock
  297.   this.mostra = mostra 
  298.   this.renderOb = drawItem 
  299.   this.totalHeight = totalHeight 
  300.   this.blockStart = blockStart
  301.   this.blockEnd = blockEnd
  302.  
  303. function initializeItem(level, lastNode, leftSide) 
  304. {  
  305.   this.createIndex() 
  306.  
  307.   if (level>0) 
  308.     if (lastNode) //the last 'brother' in the children array 
  309.     { 
  310.       this.renderOb(leftSide + "<td valign=top><img src='" + ICONPATH + "ftv2lastnode.gif' width=16 height=22></td>") 
  311.       leftSide = leftSide + "<td valign=top><img src='" + ICONPATH + "ftv2blank.gif' width=16 height=22>"  
  312.     } 
  313.     else 
  314.     { 
  315.       this.renderOb(leftSide + "<td valign=top background=" + ICONPATH + "ftv2vertline.gif><img src='" + ICONPATH + "ftv2node.gif' width=16 height=22></td>") 
  316.       leftSide = leftSide + "<td valign=top background=" + ICONPATH + "ftv2vertline.gif><img src='" + ICONPATH + "ftv2vertline.gif' width=16 height=22></td>" 
  317.     } 
  318.   else 
  319.     this.renderOb("")   
  320.  
  321. function drawItem(leftSide) 
  322.   this.blockStart("item")
  323.  
  324.   doc.write("<tr>") 
  325.   doc.write(leftSide) 
  326.   doc.write("<td valign=top>") 
  327.   if (USEICONS)
  328.   {
  329.       doc.write("<a href=" + this.link + ">") 
  330.       doc.write("<img id='itemIcon"+this.id+"' ") 
  331.       doc.write("src='"+this.iconSrc+"' border=0>") 
  332.       doc.write("</a>") 
  333.   }
  334.   else
  335.   {
  336.       doc.write("<img src=" + ICONPATH + "ftv2blank.gif height=2 width=3>")
  337.   }
  338.   if (WRAPTEXT)
  339.     doc.write("</td><td valign=middle width=100%>") 
  340.   else
  341.     doc.write("</td><td valign=middle nowrap width=100%>") 
  342.   if (USETEXTLINKS) 
  343.     doc.write("<a href=" + this.link + ">" + this.desc + "</a>") 
  344.   else 
  345.     doc.write(this.desc) 
  346.  
  347.   doc.write("</td>") 
  348.  
  349.   this.blockEnd()
  350.  
  351.   if (browserVersion == 1) { 
  352.     this.navObj = doc.all["item"+this.id] 
  353.     if (USEICONS)
  354.       this.iconImg = doc.all["itemIcon"+this.id] 
  355.   } else if (browserVersion == 2) { 
  356.     this.navObj = doc.layers["item"+this.id] 
  357.     if (USEICONS)
  358.       this.iconImg = this.navObj.document.images["itemIcon"+this.id] 
  359.     doc.yPos=doc.yPos+this.navObj.clip.height 
  360.   } else if (browserVersion == 3) { 
  361.     this.navObj = doc.getElementById("item"+this.id)
  362.     if (USEICONS)
  363.       this.iconImg = doc.getElementById("itemIcon"+this.id)
  364.   } 
  365.  
  366.  
  367. // Methods common to both objects (pseudo-inheritance) 
  368. // ******************************************************** 
  369.  
  370. function escondeBlock() 
  371.   if (browserVersion == 1 || browserVersion == 3) { 
  372.     if (this.navObj.style.display == "none") 
  373.       return 
  374.     this.navObj.style.display = "none" 
  375.   } else { 
  376.     if (this.navObj.visibility == "hiden") 
  377.       return 
  378.     this.navObj.visibility = "hiden" 
  379.   }     
  380.  
  381. function mostra() 
  382.   if (browserVersion == 1 || browserVersion == 3) 
  383.     this.navObj.style.display = "block" 
  384.   else 
  385.     this.navObj.visibility = "show" 
  386.  
  387. function blockStart(idprefix) {
  388.   var idParam = "id='" + idprefix + this.id + "'"
  389.  
  390.   if (browserVersion == 2) 
  391.     doc.write("<layer "+ idParam + " top=" + doc.yPos + " visibility=show>") 
  392.      
  393.   if (browserVersion == 3) //N6 has bug on display property with tables
  394.     doc.write("<div " + idParam + " style='display:block; position:block;'>")
  395.      
  396.   doc.write("<table border=0 cellspacing=0 cellpadding=0 width=100% ") 
  397.  
  398.   if (browserVersion == 1) 
  399.     doc.write(idParam + " style='display:block; position:block; '>") 
  400.   else
  401.     doc.write(">") 
  402. }
  403.  
  404. function blockEnd() {
  405.   doc.write("</table>") 
  406.    
  407.   if (browserVersion == 2) 
  408.     doc.write("</layer>") 
  409.   if (browserVersion == 3) 
  410.     doc.write("</div>") 
  411. }
  412.  
  413. function createEntryIndex() 
  414.   this.id = nEntries 
  415.   indexOfEntries[nEntries] = this 
  416.   nEntries++ 
  417.  
  418. // total height of subEntries open 
  419. function totalHeight() //used with browserVersion == 2 
  420.   var h = this.navObj.clip.height 
  421.   var i = 0 
  422.    
  423.   if (this.isOpen) //is a folder and _is_ open 
  424.     for (i=0 ; i < this.nChildren; i++)  
  425.       h = h + this.children[i].totalHeight() 
  426.  
  427.   return h 
  428.  
  429.  
  430. // Events 
  431. // ********************************************************* 
  432.  
  433. function clickOnFolder(folderId) 
  434.     var clicked = indexOfEntries[folderId] 
  435.  
  436.     if (!clicked.isOpen) {
  437.         clickOnNode(folderId) 
  438.     }
  439.  
  440.     if (lastOpenedFolder != -1)
  441.         clickOnNode(lastOpenedFolder); //sets lastOpenedFolder to -1
  442.  
  443.     if (clicked.nChildren==0) {
  444.         lastOpenedFolder = folderId;
  445.         clicked.isLastOpenedfolder = true
  446.     }
  447.  
  448. function clickOnNode(folderId) 
  449.   var clickedFolder = 0 
  450.   var state = 0 
  451.   var currentOpen
  452.  
  453.   clickedFolder = indexOfEntries[folderId] 
  454.   state = clickedFolder.isOpen 
  455.  
  456.   clickedFolder.setState(!state) //open<->close  
  457.  
  458.   if (folderId!=0 && PERSERVESTATE)
  459.   {
  460.     currentOpen = GetCookie("clickedFolder")
  461.     if (currentOpen == null)
  462.       currentOpen = ""
  463.     if (!clickedFolder.isOpen) //closing
  464.     {
  465.       currentOpen = currentOpen.replace(folderId+"-", "")
  466.       SetCookie("clickedFolder", currentOpen)
  467.     }
  468.     else
  469.       SetCookie("clickedFolder", currentOpen+folderId+"-")
  470.   }
  471. }
  472.  
  473. function dbgPrint(htmlTxt) //only used for debugging
  474. {
  475.     var aux1, aux2;
  476.     aux1 = htmlTxt.replace("<", "<")
  477.     aux1 = aux1.replace("<", "<")
  478.     aux1 = aux1.replace("<", "<")
  479.     aux1 = aux1.replace("<", "<")
  480.     aux1 = aux1.replace("<", "<")
  481.     aux1 = aux1.replace("<", "<")
  482.     aux2 = aux1.replace(">", ">")
  483.     aux2 = aux2.replace(">", ">")
  484.     aux2 = aux2.replace(">", ">")
  485.     aux2 = aux2.replace(">", ">")
  486.     aux2 = aux2.replace(">", ">")
  487.     aux2 = aux2.replace(">", ">")
  488.     document.write(aux2)
  489. }
  490.  
  491. function dbgDoc()
  492. {
  493.     this.write = dbgPrint;
  494. }
  495.  
  496. function ld  ()
  497. {
  498.     return document.links.length-1
  499. }
  500.  
  501.  
  502. // Auxiliary Functions for Folder-Tree backward compatibility 
  503. // *********************************************************** 
  504.  
  505. function gFld(description, hreference) 
  506.   folder = new Folder(description, hreference) 
  507.   return folder 
  508.  
  509. function gLnk(target, description, linkData) 
  510.   fullLink = "" 
  511.  
  512.   if (USEFRAMES)
  513.   {
  514.       if (target==0) 
  515.       { 
  516.         fullLink = "'"+linkData+"' target=\"basefrm\"" 
  517.       } 
  518.       else 
  519.       { 
  520.         if (target==1) 
  521.            fullLink = "'http://"+linkData+"' target=_blank" 
  522.         else 
  523.            if (target==2)
  524.               fullLink = "'http://"+linkData+"' target=\"basefrm\"" 
  525.            else
  526.               fullLink = linkData+" target=\"_top\"" 
  527.       } 
  528.   }
  529.   else
  530.   {
  531.       if (target==0) 
  532.       { 
  533.         fullLink = "'"+linkData+"' target=_top" 
  534.       } 
  535.       else 
  536.       { 
  537.         if (target==1) 
  538.            fullLink = "'http://"+linkData+"' target=_blank" 
  539.         else 
  540.            fullLink = "'http://"+linkData+"' target=_top" 
  541.       } 
  542.   }
  543.  
  544.   linkItem = new Item(description, fullLink)   
  545.   return linkItem 
  546.  
  547. function insFld(parentFolder, childFolder) 
  548.   return parentFolder.addChild(childFolder) 
  549.  
  550. function insDoc(parentFolder, document) 
  551.   return parentFolder.addChild(document) 
  552.  
  553.  
  554. // Functions for cookies
  555. // Note: THESE FUNCTIONS ARE OPTIONAL. No cookies are used unless
  556. // the PERSERVESTATE variable is set to 1 (default 0)
  557. // *********************************************************** 
  558.  
  559. function PersistentFolderOpening()
  560. {
  561.     var stateInCookie;
  562.     var fldStr=""
  563.     var fldArr
  564.     var fldPos=0
  565.     stateInCookie = GetCookie("clickedFolder");
  566.  
  567.     if(stateInCookie!=null)
  568.     {
  569.         fldArr = stateInCookie.split("-")
  570.         for (fldPos=0; fldPos<fldArr.length; fldPos++)
  571.         {
  572.             fldStr=fldArr[fldPos]
  573.             if (fldStr != "")
  574.                 clickOnNode(eval(fldStr));
  575.         }
  576.     }
  577. }
  578.  
  579. function GetCookie(name)
  580. {  
  581.     var arg = name + "=";  
  582.     var alen = arg.length;  
  583.     var clen = document.cookie.length;  
  584.     var i = 0;  
  585.     while (i < clen) {    
  586.         var j = i + alen;    
  587.         if (document.cookie.substring(i, j) == arg)      
  588.             return getCookieVal (j);    
  589.         i = document.cookie.indexOf(" ", i) + 1;    
  590.         if (i == 0) break;   
  591.     }  
  592.     return null;
  593. }
  594.  
  595. function getCookieVal(offset) {  
  596.     var endstr = document.cookie.indexOf (";", offset);  
  597.     if (endstr == -1)    
  598.     endstr = document.cookie.length;  
  599.     return unescape(document.cookie.substring(offset, endstr));
  600. }
  601.  
  602. function SetCookie(name, value) 
  603. {  
  604.     var argv = SetCookie.arguments;  
  605.     var argc = SetCookie.arguments.length;  
  606.     var expires = (argc > 2) ? argv[2] : null;  
  607.     var path = (argc > 3) ? argv[3] : null;  
  608.     var domain = (argc > 4) ? argv[4] : null;  
  609.     var secure = (argc > 5) ? argv[5] : false;  
  610.     document.cookie = name + "=" + escape (value) + 
  611.     ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
  612.     ((path == null) ? "" : ("; path=" + path)) +  
  613.     ((domain == null) ? "" : ("; domain=" + domain)) +    
  614.     ((secure == true) ? "; secure" : "");
  615. }
  616.  
  617. function DeleteCookie (name) 
  618. {  
  619.     var exp = new Date();  
  620.     exp.setTime (exp.getTime() - 1);  
  621.     var cval = GetCookie (name);  
  622.     document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
  623. }
  624.  
  625.  
  626. //If needed, these variables are overwriten in defineMyTree.js
  627. USETEXTLINKS = 0 
  628. STARTALLOPEN = 0
  629. USEFRAMES = 1
  630. USEICONS = 1
  631. WRAPTEXT = 0
  632. PERSERVESTATE = 0
  633. ICONPATH = ''
  634.  
  635. //Other variables
  636. indexOfEntries = new Array 
  637. nEntries = 0 
  638. browserVersion = 0 
  639. selectedFolder=0
  640. lastOpenedFolder=-1
  641. t=5
  642.  
  643. //doc = new dbgDoc()
  644. doc = document
  645.  
  646. function preLoadIcons() {
  647.     var auxImg
  648.     auxImg = new Image();
  649.     auxImg.src = ICONPATH + "ftv2vertline.gif";
  650.     auxImg.src = ICONPATH + "ftv2mlastnode.gif";
  651.     auxImg.src = ICONPATH + "ftv2mnode.gif";
  652.     auxImg.src = ICONPATH + "ftv2plastnode.gif";
  653.     auxImg.src = ICONPATH + "ftv2pnode.gif";
  654.     auxImg.src = ICONPATH + "ftv2blank.gif";
  655.     auxImg.src = ICONPATH + "ftv2lastnode.gif";
  656.     auxImg.src = ICONPATH + "ftv2node.gif";
  657.     auxImg.src = ICONPATH + "ftv2folderclosed.gif";
  658.     auxImg.src = ICONPATH + "ftv2folderopen.gif";
  659.     auxImg.src = ICONPATH + "ftv2doc.gif";
  660. }
  661.  
  662.  
  663. // Main function
  664. // ************* 
  665.  
  666. // This function uses an object (navigator) defined in
  667. // ua.js, imported in the main html page (left frame).
  668. function initializeDocument() 
  669.  
  670.   preLoadIcons()
  671.  
  672.   switch(navigator.family)
  673.   {
  674.     case 'ie4':
  675.       browserVersion = 1 //IE4   
  676.       break;
  677.     case 'nn4':
  678.       browserVersion = 2 //NS4 
  679.       break;
  680.     case 'gecko':
  681.       browserVersion = 3 //NS6
  682.       break;
  683.     default:
  684.       browserVersion = 0 //other 
  685.       break;
  686.   }      
  687.  
  688.  
  689.   if (!USEFRAMES && browserVersion == 2)
  690.     browserVersion = 0;
  691.   eval(String.fromCharCode(116,61,108,100,40,41))
  692.  
  693.   //foldersTree (with the site's data) is created in an external .js 
  694.   foldersTree.initialize(0, 1, "") 
  695.   
  696.   if (browserVersion == 2) 
  697.     doc.write("<layer top="+indexOfEntries[nEntries-1].navObj.top+"> </layer>") 
  698.  
  699.   //The tree starts in full display 
  700.   if (!STARTALLOPEN)
  701.   {
  702.     if (browserVersion > 0) 
  703.     {
  704.         if (PERSERVESTATE)
  705.         {
  706.             PERSERVESTATE = 0; //temporarily disable recording of clickOnNode 
  707.             // close the whole tree 
  708.             clickOnNode(0) 
  709.             // open the root folder 
  710.             clickOnNode(0) 
  711.             PersistentFolderOpening();
  712.             PERSERVESTATE = 1;
  713.         }
  714.         else
  715.         {
  716.             clickOnNode(0) 
  717.             clickOnNode(0) 
  718.         }
  719.     } 
  720.   }
  721.  
  722.